package own.stu.jobgib.playown.fsm.hfsm;

import lombok.Data;

@Data
public abstract class StateBase {

    // 当前类型
    private StateEnum state;

    // 状态转换事件，要转换状态的通知
    private Action<StateEnum> action;

    // 进入该状态
    public abstract void onEnter();

    // 执行该状态的行为
    public abstract void onExecute();

    // 退出该状态
    public abstract void onExit();

    public StateBase(StateEnum state) {
        this.state = state;
    }

    protected void transitionEvent(StateEnum state) {
        action.transitionEvent(state);
    }
}
